<template>
  <button @click="showInfor" > 点击按钮更换图片</button>
  <img :src="url" />
  <input type="text" @keydown="showInfor1" />
</template>

<script setup>
import { ref } from 'vue';
let url = ref(new URL('../assets/img1.png', import.meta.url).href);
const showInfor=()=>{
   // console.log("欢迎来到Vue3内置指令"); 
url.value = new URL('../assets/img2.png', import.meta.url).href;
};
const showInfor1 = () => {
alert("按下按钮");
};
</script>
<style>

</style>